<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Class example -- double underscore</title>
    <link rel="stylesheet" type="text/css" href="../example.css" />
  </head>
<body>
<div id="doc4">
  <div class="hd">
    <div class="logo" style="float:left;"><a href="http://code.google.com/p/double-underscore/" target="_blank"><img src="http://stauren.net/misc/images/bullhead.gif" /></a></div>
    <div class="hd-title">du class example</div>
  </div>

  <div class="hd">
    <a href="http://code.google.com/p/double-underscore/wiki/DocDuClass">more docs </a>
    <h1>code</h1>
<pre>
&lt;script src="http://double-underscore.googlecode.com/svn/trunk/src/loader/loader.js"&gt;&lt;/script&gt;
//NOTICE: loader.js in trunk is not stable, should always use the newest loader in pkgs
&lt;script&gt;
__.load('core', function() {
    var Person = __.Class.extend({
      shout : function() {
        dolog('I am a person!');
      },
      init: function(isDancing){
        this.dancing = isDancing;
      }
    });

    var Ninja = Person.extend({
      shout : function() {
        dolog('shhh...');
      },
      init: function(){
        this._super( false );
        this.isNinja = true;
      }
    });
    var p = new Person(true);
    dolog(p.dancing); // => true
    p.shout(); // => I am a person!

    var n = new Ninja();
    dolog(n.dancing); // => false
    dolog(n.isNinja); // => true
    n.shout(); // => shhh...
});
&lt;/script&gt;
</pre>
  </div>
</div>
<script src="../example.js"></script>
<script src="http://double-underscore.googlecode.com/svn/trunk/src/loader/loader.js"></script>
<script>
__.load('core', function() {
    var Person = __.Class.extend({
      shout : function() {
        dolog('I am a person!');
      },
      init: function(isDancing){
        this.dancing = isDancing;
      }
    });

    var Ninja = Person.extend({
      shout : function() {
        dolog('shhh...');
      },
      init: function(){
        this._super( false );
        this.isNinja = true;
      }
    });
    var p = new Person(true);
    dolog(p.dancing); // => true
    p.shout(); // => I am a person!

    var n = new Ninja();
    dolog(n.dancing); // => false
    dolog(n.isNinja); // => true
    n.shout(); // => shhh...
});
</script>
</body>
</html>
